package com.example.framework;

import java.util.Properties;

public class ApplicationManager {

	private static ApplicationManager singleton ;
	private SeleniumHelper seleniumHelper;
	private GroupHelper groupHelper;

	private NavigationHelper navigationHelper;
	private ContactHelper contactHelper;
	private Properties properties;


	public String getProperties(String key) {
		return properties.getProperty(key);
	}
	public String getProperties(String key, String defaultValue) {
		return properties.getProperty(key, defaultValue);
	}

	public static ApplicationManager getInstance() {
		if (singleton == null) {
			singleton = new ApplicationManager();
		}
		return singleton;
	}

	public void stop() {
		if (seleniumHelper != null) {
			seleniumHelper.finish();
		}
	}
	
	SeleniumHelper getSeleniumHelper() {
		if (seleniumHelper == null) {
			seleniumHelper = new SeleniumHelper(getInstance());//remove manager from here!!!!
		}
		return seleniumHelper;
	}

	public GroupHelper getGroupHelper() {
		if (groupHelper == null) {
			groupHelper = new GroupHelper(this);
		}
		return groupHelper;
	}

	public NavigationHelper getNavigationHelper() {
		if (navigationHelper == null) {
			navigationHelper = new NavigationHelper(this);
		}
		return navigationHelper;
	}
	

	public ContactHelper getContactHelper() {
		if (contactHelper == null) {
			contactHelper = new ContactHelper(this);
		}
		return contactHelper;
	}

	public void setProperties(Properties properties) {
		this.properties = properties;
		
	}


}
